feat(integration-discord): add purge-invites command#333
Conversation
Artisan command to delete unused Discord guild invites. Supports --dry-run preview and --include-expiring flag.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository YAML (base), Central YAML (inherited) Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds a Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In
`@app-modules/integration-discord/src/Sync/Actions/PurgeUnusedInvitesAction.php`:
- Around line 27-30: The response from ListGuildInvites is not validated for
success before calling json() on it, meaning error responses from Discord will
be processed as if they were valid invite lists. Add a response status check
immediately after the send() call for ListGuildInvites, consistent with the
validation pattern used in the delete loop (around line 71), to ensure the
response indicates success before attempting to parse and process the invites
data.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository YAML (base), Central YAML (inherited)
Review profile: CHILL
Plan: Pro
Run ID: 748d69b7-e316-4951-8096-fa6b36fea819
⛔ Files ignored due to path filters (1)
composer.lockis excluded by!**/*.lock
📒 Files selected for processing (9)
app-modules/integration-discord/src/IntegrationDiscordServiceProvider.phpapp-modules/integration-discord/src/Sync/Actions/PurgeUnusedInvitesAction.phpapp-modules/integration-discord/src/Sync/Console/PurgeUnusedInvitesCommand.phpapp-modules/integration-discord/src/Transport/Requests/Invites/DeleteInvite.phpapp-modules/integration-discord/src/Transport/Requests/Invites/ListGuildInvites.phpapp-modules/integration-discord/tests/Unit/Sync/PurgeUnusedInvitesActionTest.phpapp-modules/integration-discord/tests/Unit/Transport/Requests/DeleteInviteTest.phpapp-modules/integration-discord/tests/Unit/Transport/Requests/ListGuildInvitesTest.phpcomposer.json
Summary
discord:purge-invitesArtisan command to delete unused Discord guild invites (max_age=0, uses=0)--dry-runto preview matches and--include-expiringto also target time-limited unused invitesCreated Atusingapp.display_timezoneTest plan
php artisan discord:purge-invites --dry-run— lists matching invites without deletingphp artisan discord:purge-invites— deletes matching invitesphp artisan discord:purge-invites --include-expiring --dry-run— includes expiring invitesphp artisan test --filter=PurgeUnusedInvites)